package mainFragment.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.xuegengwang.xuegengwang.R;

import java.util.ArrayList;

import mainFragment.bean.CollegeIndexOABean;


/**
 * Created by Administrator on 2017/6/12.
 */

public class CollegeIndexOAAdapter1 extends BaseAdapter {
    private Context context;
    private ArrayList<CollegeIndexOABean> arrayList;

    public CollegeIndexOAAdapter1(Context context, ArrayList<CollegeIndexOABean> arrayList) {
        this.context = context;
        this.arrayList = arrayList;
    }

    @Override
    public int getCount() {
        return arrayList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyHolder myHolder;
        if (convertView == null) {
            myHolder = new MyHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.college_index_oa_item1, null);
            myHolder.college_index_oa_item1_tv = (TextView) convertView.findViewById(R.id.college_index_oa_item1_tv);
            myHolder.college_index_oa_item1_detail = (TextView) convertView.findViewById(R.id.college_index_oa_item1_detail);
        } else {
            myHolder = (MyHolder) convertView.getTag();
        }
        myHolder.college_index_oa_item1_tv.setText(arrayList.get(position).getText());
        myHolder.college_index_oa_item1_detail.setText(arrayList.get(position).getDetail());
        return convertView;
    }

    class MyHolder {
        TextView college_index_oa_item1_tv;
        TextView college_index_oa_item1_detail;
    }
}
